package com.fzu.thirdpartyservice.controller;

import com.fzu.commonutil.util.R;
import com.fzu.thirdpartyservice.util.FileUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author zyq
 * @Description 文件控制器
 * @Version 1.0
 **/
@RestController
@RequiredArgsConstructor
public class OssController {

    private final FileUtil fileUtil;

    /**
     * 上传图片到OSS文件系统并返回URL
     */
    @PostMapping("/upload")
    public R upload(MultipartFile file) {
        return R.ok().data(fileUtil.upload(file));
    }
}
